package net.scala.dictionary

import java.util.Properties

/**
 * 读取词典内容
 * @author Barudisshu
 */
case class Prop(file:String = "scala-dictionary/src/main/resources/dic.properties") {
  require(file !=null,"文件名不为空")
  def tran(k: String):String = {
    try {
      val lines = io.Source.fromFile(file).bufferedReader()
      val p = new Properties()
      p.load(lines)
      p.getProperty(k)
    } catch {
      case e: Exception => null
    }
  }
}
